/*
 * @Author: Yang Zhang
 * @Date: 2021-11-29 22:29:06
 * @LastEditors: Yang Zhang
 * @LastEditTime: 2021-12-07 23:02:50
 * @Description: common接口api列表
 */

import { request } from "../utils/request"
import { IEmailcodeVer, IEmailVer, IGetsms, IPrever, ISliderver } from "./types"


const commonApi = {
  sendEmailVertifyNum: '/common/email',
  verifyEmailNum: '/common/email/verifyCode',
  sendSmsNum: '/common/sms',
  getSliderver: '/common/slider'
}




/**
 * 
 * @description: 获取邮箱验证码接口
 * @param: interface IEmailVer
 * @returns 
 */

export const sendEmailVernum = (data: IEmailVer) => {
  return request({
    url: `${commonApi.sendEmailVertifyNum}/${data.verificationEnums}/${data.email}`,
    method: 'get',
    params: data
  })
}


/**
 * @description:校验邮箱验证码
 *
 * @returns
 */
export const verifyEmailcode = (data: IEmailcodeVer) => {
  return request({
    url: `${commonApi.verifyEmailNum}/${data.verificationEnums}${data.email}/${data.code}`,
    method: 'get',
    params: data
  })
}


/**
 * @description:获取短信验证码
 *
 * @returns
 */
export const getSmsVercode = (data: IGetsms) => {
  return request({
    url: `${commonApi.sendSmsNum}/${data.verificationEnums}/${data.mobile}`,
    method: 'get',
    params: data
  })
}


/**
 * @description :获取滑块验证码校验接口数据
 */
export const getSliderVerdata = (data: ISliderver) => {
  return request({
    url: `${commonApi.getSliderver}/${data.verificationEnums}`,
    method: 'get'
  })
}

/**
 * @description 预校验
 */

export const preVercode = (data: IPrever) => {
  return request({
    url: `${commonApi.getSliderver}/${data.verificationEnums}`,
    method: 'post',
    data,
    formData: true
  })
}